﻿//Copyright (c) Microsoft Corporation. All rights reserved.

using Microsoft.Ted.Wacel;

namespace Microsoft.Ted.Wacel.TestConsole
{
    public class DimensionTester
    {
        public static void TimeDimensionMonthDaysTest()
        {
            var dimension = Dimension.GetTimeDimensionMonthDays(2013);
            VisualTester.AreEqual("Time", dimension.Name);
            VisualTester.AreEqual((int)DimensionNodeType.DateTimeYear, (int)dimension.Children[0].NodeType); //Single root for the year
            VisualTester.AreEqual(1, dimension.Children.Count); //Only one root node
            VisualTester.AreEqual(12, dimension.Children[0].Children.Count); //the root should have 12 months 
            VisualTester.AreEqual(31, dimension.Children[0].Children[9].Children.Count); //october should have 31 days
            VisualTester.AreEqual(dimension.Children[0], dimension.Children[0].Children[9].Parent); //september should be a child of the year
        }
        public static void TimeDimensionMonthDayHoursTest()
        {
            var dimension = Dimension.GetTimeDimensionMonthDayHours(2013);
            VisualTester.AreEqual("Time", dimension.Name);
            VisualTester.AreEqual((int)DimensionNodeType.DateTimeYear, (int)dimension.Children[0].NodeType); //Single root for the year
            VisualTester.AreEqual(24, dimension.Children[0].Children[9].Children[1].Children.Count); //a day should have 24 hours
            VisualTester.AreEqual("Oct2_13", dimension.Children[0].Children[9].Children[1].Children[13].Name); //13 hour
        }
        public static void TimeDimensionMonthDayHour5MinutesTest()
        {
            var dimension = Dimension.GetTimeDimensionMonthDayHour5Minutes(2013);
            VisualTester.AreEqual("Time", dimension.Name);
            VisualTester.AreEqual((int)DimensionNodeType.DateTimeYear, (int)dimension.Children[0].NodeType); //Single root for the year
            VisualTester.AreEqual(12, dimension.Children[0].Children[9].Children[1].Children[2].Children.Count); //an hour should have 12 5-min slots
            VisualTester.AreEqual("Oct2_2_15", dimension.Children[0].Children[9].Children[1].Children[2].Children[3].Name); //2 hour 15-20 minutes
        }
    }
}
